import { ApiProperty } from '@nestjs/swagger';

export class Result<T>{
  @ApiProperty({ description: '是否成功',example:true})
  public success:boolean
  @ApiProperty({ description: '提示信息',example:'操作成功'})
  public message:string
  constructor(success:boolean,message:string) {
    this.success = success
    this.message = message
  }

  static success<T>(message:string):Result<T>{
    return new Result<T>(true,message)
  }
  static fail<T>(message:string):Result<T>{
    return new Result<T>(false,message)
  }
}